﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System
{
    public static class Extentions
    {
        /// <summary>
        /// 枚举类型转换。
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="enumStr"></param>
        /// <returns></returns>
        public static T ToEnum<T>(this string enumStr)
        {
            var em = enumStr.Substring(0, 1).ToUpper() + enumStr.Substring(1);

            return (T) Enum.Parse(typeof (T), em);
        }
    }
}
